<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path = request.getContextPath();%>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="author" content="order by dede58.com"/>
    <title>增加房间</title>
    <jsp:include page="common.jsp"/>

</head>
<body>
<div class="main_box">
    <h2><span></span>增加房间</h2>
    <div class="cont_box">
        <form action="#" method="post" id="house_form">
            <ul class="addpro_box adduser_box">
                <li>
                    <label>房间号：</label>
                    <input style="height: 38px;" type="text" placeholder="请输入房间号" name="name" id="name"
                           data-msg-required="房间号不能为空"/>
                </li>
                <li>
                    <label>房间类型：</label>
                    <input style="height: 38px;" type="text" placeholder="请输入房间类型" name="amount" id="amount"
                           data-msg-required="房间类型不能为空"/>
                </li>
                <li>
                    <label>价格：</label>
                    <input style="height: 38px;" type="text" placeholder="请输入价格" name="pirce" id="price"
                           data-msg-required="价格不能为空"/>
                </li>
                <li>
                    <label>所在楼层：</label>
                    <input style="height: 38px;" type="text" placeholder="请输入所在楼层" name="flood_id" id="flood_id"
                           data-msg-required="楼层不能为空"/>
                </li>
                <li>
                    <label>房间状态：</label>
                    <input style="height: 38px;" type="text" placeholder="请输入房间状态" name="state" id="state"
                           data-msg-required="状态不能为空"/>
                </li>
                <li>
                    <label>当前入住人：</label>
                    <input style="height: 38px;" type="text" placeholder="请输入当前入住人" name="customer_id"
                           id="customer_id"/>
                </li>

            </ul>
            <div class="probtn_box clearfix">
                <input type="submit" onclick="add()" value="添加房间" class="btn blue_btn"/>
            </div>
        </form>
    </div>
</div>
<!--javascript include-->
<script>
    // $(function(){
    // 	$("body").other({formId:"#user_form",formUrl:"#",linkHref:""});//formUrl 表单请求地址,linkHref 请求成功后跳转地址，可不填
    // 	$("#carmodel").cxSelect({
    // 		url: "js/carModel.json",
    // 		selects: ["carbrand", "carmodela", "carmodelb", "carmodelc"],
    // 		emptyStyle: "none"
    // 	});
    // });
    function add() {
        $.ajax({
            url: "house/add",
            method: "post",
            dataType: "JSON",
            data: {
                name: $("#name").val(),
                amount: $("#amount").val(),
                price: $("#price").val(),
                floorId: $("#flood_id").val(),
                state: $("#state").val()
            },
            success: function (data) {
                if (data > 0) alert("添加成功！！")
                else alert("添加失败！！")
            },
            error: function (e) {
                alert("通讯失败")
            }
        });
    }
</script>
</body>
</html>